from app import mongo  # 导入MongoDB连接实例
from datetime import datetime

def insert_test_building():
    existing = mongo.db.buildings.find_one({"name": "推荐测试建筑"})
    if not existing:
        test_data = {
            "name": "围龙屋",  # 名称区分
            "address": "广东省梅州市",
            "imageUrl": "https://free.picui.cn/free/2025/08/20/68a5820b92825.jpeg",
            "description": "屋子合围，形似一条龙",
            "is_recommended": True,  
            "created_at": datetime.utcnow()
        }
        result = mongo.db.buildings.insert_one(test_data)
        print(f"推荐测试建筑插入成功，ID: {result.inserted_id}")
    else:
        print("推荐测试建筑已存在")

if __name__ == "__main__":
    insert_test_building()